﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XZL.GM.Bll;
using XZL.GM.Dal;

namespace XZL.GM.Bll
{
    public class AccountInfo
    {
        /// <summary>
        /// 获取账户列表
        /// </summary>
        /// <param name="ItemID"></param>
        /// <returns></returns>
        /// 
        public static List<Proc_AccountInfo_SelectListResult> GetAccountList(DateTime accountStart, DateTime accountEnd, string orderID, string nickName, int accountType, int payType, int pageIndex, int pageSize, ref int? pageCount)
        {
            Account_GMDataContext ax = new Account_GMDataContext();
            return ax.Proc_AccountInfo_SelectList(accountStart, accountEnd, orderID, nickName, accountType, payType, pageIndex, pageSize, ref pageCount).ToList();

        }

        /// <summary>
        /// 获取账户信息
        /// </summary>
        /// <param name="ItemID"></param>
        /// <returns></returns>
        /// 
        public static List<Proc_AccountType_SelectListResult> GetAccountTypeList()
        {
            Account_GMDataContext ax = new Account_GMDataContext();

            return ax.Proc_AccountType_SelectList().ToList();
        }

        /// <summary>
        /// 获取返奖信息
        /// </summary>
        /// <param name="rewardID"></param>
        /// <returns></returns>
        /// 
        public static List<Proc_ReturnRatio_SelectListResult> GetReturnRatio()
        {
            Account_GMDataContext ax = new Account_GMDataContext();
            return ax.Proc_ReturnRatio_SelectList().ToList();
        }

        /// <summary>
        /// 修改返奖比例
        /// </summary>
        /// <param name="rewardID"></param>
        /// <param name="ratio"></param> 
        /// <returns></returns> 
        /// 
        public static bool UpdateReturnRatio(int rewardID, double ratio)
        {
            Account_GMDataContext ax = new Account_GMDataContext();
            ax.Proc_ReturnRatio_Update(rewardID, ratio);
            return true;
        }

        /// <summary>
        /// 获取个人消费
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public static List<Proc_AccountLog_UserExpenseResult> GetUserExpense(string userID, DateTime start, DateTime end, ref double? count)
        {
            Account_GMDataContext db = new Account_GMDataContext();
            return db.Proc_AccountLog_UserExpense(userID, start, end, ref count).ToList();
        }

        /// <summary>
        /// 获取推广消费
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public static List<Proc_AccountLog_PromoteExpenseResult> GetPromoteExpense(string userID, DateTime start, DateTime end, ref double? amount, ref int? userCount)
        {
            Account_GMDataContext db = new Account_GMDataContext();
            return db.Proc_AccountLog_PromoteExpense(userID, start, end, ref amount, ref userCount).ToList();
        }

        /// <summary>
        /// 获取小组消费
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public static List<Proc_AccountLog_TeamExpenseResult> GetTeamExpense(string userID, DateTime start, DateTime end, ref double? amount, ref int? userCount)
        {
            Account_GMDataContext db = new Account_GMDataContext();
            return db.Proc_AccountLog_TeamExpense(userID, start, end, ref amount, ref userCount).ToList();
        }
    }
}
